<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>药品管理-登录</title>
    <link rel="stylesheet" type="text/css" href="css/common.css">
    <link rel="stylesheet" type="text/css" href="css/login.css">
	<script src="js/jquery-3.3.1.js"></script>
<script type="text/javascript">

    $(function(){
            //解决java后台跳出iframe的解决方法
            if (window != top)
                     top.location.href = location.href;
         })
</script>
</head>

<body>
<!--引入头部-->
<div id="header"></div>
    <!-- 头部 end -->
    <section id="login_wrap">
        <div class="fullscreen-bg" style="background: url(images/2e6025.jpg);height: 750px;">
			<div class="aaaa" style=" margin: 0 auto;position: relative;top: 32%;float: left;left: 256px;" >
				<h1 style="font-size:50px;height: 100px;width: 2000px">荥阳市药品采购平台</h1>
			</div>
        </div>
        <div class="login-box">
        	<div class="title">
        		<span>欢迎登录药品管理</span>
        	</div>

        	<div class="login_inner">


				<!--登录错误提示消息-->
				<form id="loginForm" action="" method="post" accept-charset="utf-8">
					<input name="username" type="text" placeholder="请输入账号" autocomplete="off">
        			<input name="password" type="password" placeholder="请输入密码" autocomplete="off">
        			<div class="verify">
					<input name="check" type="text" placeholder="请输入验证码" autocomplete="off">
					<span><img id="img" onclick="changeCheckCode(this)"></span>
			</div>
			<div class="submit_btn" style="height: 40px;margin: 50px auto;position: relative;float: left;left: -179px;">

				<span>
					<button type="button"  style="height: 40px;" id="btn_re">重置</button>
					<body onkeydown="keyLogin();"/>
					<button type="button" onclick="denglu()" id="btn_sub">登录</button>
				</span>
			</div>
        		</form>
        		<div class="reg">没有账户？<a href="/myspringboot/static/register.html">立即注册</a></div>
        	</div>
        </div>
    </section>
    <!--引入尾部-->
    <div id="footer"></div>
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="js/jquery-1.11.0.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>
    <!--导入布局js，共享header和footer-->
    <script type="text/javascript" src="js/include.js"></script>
</body>
<script type="text/javascript">
    $(function () {
        changeCheckCode();
    })
</script>
<script type="text/javascript">
    //图片点击事件
    function changeCheckCode() {
        document.getElementById("img").src="checkCode?"+new Date().getTime();
    }
</script>
<script type="text/javascript">
    function keyLogin(){
        if (event.keyCode==13)  //回车键的键值为13
            document.getElementById("btn_sub").click(); //调用登录按钮的登录事件
    }
    function denglu () {
        //点击登录按钮获取值
        var username = $("input[name='username']").val();
        var password = $("input[name='password']").val();
        var check = $("input[name='check']").val();
        console.log(username)
        $.ajax({
            url: '/myspringboot/login',
            type: 'POST',
            dataType: "json",
            data:{
                username:username,
                password:password,
                check:check
			},
			success:function (result) {
                console.log(result)
                if (result.code==1) {
                    window.location.href="/myspringboot/static/index.html"
				}else {
                    alert(result.msg)
                    window.location.href="login.html"
				}

            }
        })
    }
</script>
</html>